Skip to content

Fix condition move: update existing POC instead of creating duplicate#137

Closed
Copilot wants to merge 3 commits intonext-releasefrom
copilot/fix-poc-movement-issue
Closed

Fix condition move: update existing POC instead of creating duplicate#137
Copilot wants to merge 3 commits intonext-releasefrom
copilot/fix-poc-movement-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

When moving a condition from objective A to objective B, Condition.save() was creating a fresh ProjectObjectiveCondition for the new objective while leaving the original POC (with its completion status) orphaned under the old objective. This caused a hidden/displayed POC split where the completion status was never carried over.

Changes

  • framework/models.pyCondition.save() now detects when objective is being changed on an existing condition. Instead of running get_or_create against the new objective, it calls .update(objective=self.objective) on the existing POCs, preserving status in-place. The new/unchanged-objective path also incorporates the Commitment backfill logic from the next-release branch, ensuring that new conditions at new levels create matching commitments for all existing project/work-cycle combinations:

    old_objective_id = Condition.objects.values_list("objective_id", flat=True).get(pk=self.pk)
    # ...
    ProjectObjectiveCondition.objects.filter(
        condition=self, objective_id=old_objective_id
    ).update(objective=self.objective)
  • framework/test_models.py — Added test_moving_condition_updates_poc_not_creates_duplicate to assert that after moving a condition: exactly one POC exists, it points to the new objective, and its status is preserved. Also includes the test_new_condition_with_new_level_backfills_commitment test from next-release that covers the Commitment backfill behaviour.


Manual checks

  • If you changed the Dashboard application or the rock, have you increased the version number in rockcraft.yaml? Remember to use the same version number in README.md.

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI changed the title [WIP] Fix POC movement issue and improve level calculation Fix condition move: update existing POC instead of creating duplicate Mar 28, 2026
Copilot AI requested a review from dwilding March 28, 2026 00:08
@dwilding dwilding assigned dwilding and unassigned dwilding and Copilot Mar 28, 2026
@dwilding dwilding removed their request for review March 28, 2026 00:15
Copy link
Copy Markdown
Collaborator

@dwilding dwilding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase this onto the next-release branch

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 28, 2026

Please rebase this onto the next-release branch

Done — rebased onto next-release in 8c07a37. The commit also incorporates the Commitment backfill logic and its test that were added to next-release.

@dwilding dwilding changed the base branch from main to next-release April 28, 2026 05:55
Copilot AI requested a review from dwilding April 28, 2026 05:58
@dwilding
Copy link
Copy Markdown
Collaborator

I'm going to close this and look at #136 again after the next release. There's already enough staged for the next release and I don't have time to review more additions this week.

@dwilding dwilding closed this Apr 28, 2026
@dwilding dwilding deleted the copilot/fix-poc-movement-issue branch April 28, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants